package data;

import java.sql.SQLException;
import java.util.ArrayList;

import database.DataDAO;
import database.Database;

public class Project {
	private String projectTitle;
	private int projectID, recordsPerImage, firstYCoord, recordHeight,
			numOfFields;
	ArrayList<Field> fields;
	ArrayList<Image> images;
	
	
	public Project(){	
	}
	
	/**
	 * @param inProjID new project information
	 * @param inProjTit new project information
	 * @param inRecPerImg new project information
	 * @param inYCoord new project information
	 * @param recHght new project information
	 * @param numFields new project information
	 */
	public Project(int inProjID, String inProjTit, int inRecPerImg,
			int inYCoord, int recHght, int numFields) {
		projectTitle = inProjTit;
		projectID = inProjID;
		recordsPerImage = inRecPerImg;
		firstYCoord = inYCoord;
		recordHeight = recHght;
		numOfFields = numFields;
	}
	
	public void loadProject(Database db) throws SQLException{
		DataDAO dao = db.getDataDAO();
		
		fields = dao.getAllFields(projectID);
		images = dao.getAllImages(projectID);
		
		for(Image img : images){
			img.loadImage(db);
		}
	}
	
	public void setProjectTitle(String projectTitle) {
		this.projectTitle = projectTitle;
	}

	public void setProjectID(int projectID) {
		this.projectID = projectID;
	}

	public void setRecordsPerImage(int recordsPerImage) {
		this.recordsPerImage = recordsPerImage;
	}

	public void setFirstYCoord(int firstYCoord) {
		this.firstYCoord = firstYCoord;
	}

	public void setRecordHeight(int recordHeight) {
		this.recordHeight = recordHeight;
	}

	public void setNumOfFields(int numOfFields) {
		this.numOfFields = numOfFields;
	}

	public String getProjectTitle() {
		return projectTitle;
	}

	public int getProjectID() {
		return projectID;
	}

	public int getRecordsPerImage() {
		return recordsPerImage;
	}

	public int getFirstYCoord() {
		return firstYCoord;
	}

	public int getRecordHeight() {
		return recordHeight;
	}

	public int getNumOfFields() {
		return numOfFields;
	}

}
